home *** CD-ROM | disk | FTP | other *** search
- Path: colossus.holonet.net!russell
- From: russell@news.mdli.com (Russell Blackadar)
- Newsgroups: comp.lang.c++
- Subject: Re: Help! Newbie question ...
- Date: 19 Mar 1996 22:52:03 GMT
- Organization: HoloNet National Internet Access System: 510-704-1058/modem
- Message-ID: <4indqj$eqo@colossus.holonet.net>
- References: <4ilkfu$41q@Kaos.deepcove.com> <4imrip$8gi@firebrick.mindspring.com>
- NNTP-Posting-Host: jubal.mdli.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- Justin Rudd (rudd@mindspring.com) wrote:
- > saffleck@deepcove.com (Sean Affleck) wrote:
-
- > >Is this legal ?
-
- > >class A {...};
-
- > >A f();
-
- > >main() {
- > > A a = f();
- > >}
-
- > >A f()
- > >{
- > > A fa;
- > > return fa;
- > >}
-
- > Sure is....just make sure you have a copy constructor and an
- > assignment operator.
-
- Well, I hope you don't think the assignment operator is
- invoked for an initialization. It isn't.
-
- A statement like
-
- A a = something;
-
- means exactly the same thing as
-
- A a(something);
-
- and in both cases, the appropriate ctor is invoked to do
- the initialization. The statement A a = f(); invokes the
- copy ctor.
- --
- Russell Blackadar, russell@mdli.com
-